package edu.sctu.xuping.month06.goodstest;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;

import java.io.*;


/**
 * Created by user02 on 2015/6/28.
 */
public class NetworkDataCapture {

    HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
    CloseableHttpClient closeableHttpClient = httpClientBuilder.build();

    public String httpGetInterface(String path) throws IOException {

        HttpGet httpGet = new HttpGet(path);
        HttpResponse httpResponse = closeableHttpClient.execute(httpGet);
        HttpEntity httpEntity = httpResponse.getEntity();
        String json = EntityUtils.toString(httpEntity);

        return json;
    }
}







